﻿using OConf.Model.RequestInput;
using System.ComponentModel.DataAnnotations;

namespace OConf.Model
{
    /// <summary>
    /// 保存用户信息基础请求参数
    /// </summary>
    public class SaveUserBaseInput
    {
        /// <summary>
        /// 用户昵称
        /// </summary>
        [Required(ErrorMessage = "用户昵称不能为空")]
        [MaxLength(20, ErrorMessage = "用户昵称最多20个字符")]
        public string UserName { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [MaxLength(50, ErrorMessage = "邮箱最多50个字符")]
        public string Email { get; set; }

        /// <summary>
        /// 用户角色
        /// </summary>
        [Required(ErrorMessage = "用户角色不能为空")]
        public int RoleType { get; set; }
    }

    /// <summary>
    /// 用户注册请求参数
    /// </summary>
    public class RegisterUserInput: SaveUserBaseInput
    {
        /// <summary>
        /// 账号
        /// </summary>
        [Required(ErrorMessage = "账号不能为空")]
        [MaxLength(20, ErrorMessage = "账号最多20个字符"), MinLength(3, ErrorMessage = "账号最少3个字符")]
        public string AccountNumber { get; set; }
    }

    /// <summary>
    /// 修改管理员信息请求参数
    /// </summary>
    public class EditUserInput: SaveUserBaseInput
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required(ErrorMessage = "请求参数错误")]
        public string ID { get; set; }
    }

    /// <summary>
    /// 删除管理员请求参数
    /// </summary>
    public class DeleteUserInput
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required(ErrorMessage = "请求参数错误")]
        public string ID { get; set; }
    }

    /// <summary>
    /// 用户登录请求参数
    /// </summary>
    public class UserLoginInput
    {
        /// <summary>
        /// 账号
        /// </summary>
        [Required(ErrorMessage = "账号不能为空")]
        [MinLength(3, ErrorMessage = "账号长度最少不能少于3个字符"), MaxLength(20, ErrorMessage = "账号长度不能超过20个字符")]
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [Required(ErrorMessage = "密码不能为空")]
        [MinLength(6, ErrorMessage = "密码长度最少不能少于6个字符"), MaxLength(20, ErrorMessage = "密码长度不能超过18个字符")]
        public string Password { get; set; }
    }

    /// <summary>
    /// 个人中心修改个人信息请求参数
    /// </summary>
    public class EditPersionalInfoInput
    {
        /// <summary>
        /// 用户昵称
        /// </summary>
        [Required(ErrorMessage = "用户昵称不能为空")]
        [MaxLength(20, ErrorMessage = "用户昵称最多20个字符")]
        public string UserName { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [MaxLength(50, ErrorMessage = "邮箱最多50个字符")]
        public string Email { get; set; }
    }

    /// <summary>
    /// 个人中心修改密码请求参数
    /// </summary>
    public class EditPersionalPwdInput
    {
        /// <summary>
        /// 旧密码
        /// </summary>
        [Required(ErrorMessage = "旧密码不能为空")]
        [MaxLength(18, ErrorMessage = "密码最多18个字符"), MinLength(6, ErrorMessage = "密码最少6个字符")]
        public string OldPwd { get; set; }
        /// <summary>
        /// 新密码
        /// </summary>
        [Required(ErrorMessage = "新密码不能为空")]
        [MaxLength(18, ErrorMessage = "密码最多18个字符"), MinLength(6, ErrorMessage = "密码最少6个字符")]
        public string NewPwd { get; set; }
    }

    /// <summary>
    /// 管理后台分页查询管理员列表请求参数
    /// </summary>
    public class QueryUserInput : QueryPageInputModel
    {
        /// <summary>
        /// 账号
        /// </summary>
        public string AccountNumber { get; set; }
        /// <summary>
        /// 用户名称
        /// </summary>
        public string UserName { get; set; }
    }

    /// <summary>
    /// 修改管理员状态请求参数
    /// </summary>
    public class ModifyUserEnableInput
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required(ErrorMessage = "请求参数错误")]
        public string ID { get; set; }

        /// <summary>
        /// 是否可用
        /// </summary>
        [Required(ErrorMessage = "请求参数错误")]
        public bool Enable { get; set; }
    }

    /// <summary>
    /// 管理后台获取管理员详情请求参数
    /// </summary>
    public class GetUserDetailInput
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required(ErrorMessage = "请求参数错误")]
        public string ID { get; set; }
    }
}
